

#include <physm.h>
#include <pio.h>

int main(int argc, char **argv){

  printf("physm_test: version=%s\n", _PHYSM_VERSION);
  printf("  CPU name: %s\n", _PHYSM_PROC);
  printf("  CPU architecure: %s\n", _PHYSM_ARCH);
#ifdef _PHYSM_PROC_x86_64
  printf("  Using 64 bit: yes\n");
#else
  printf("  Using 64 bit: no\n");
#endif

  /* Build cpu flags string. */
  char cpu_flags[64]; // Have to be careful with this...
  memset(cpu_flags, 0, 64);
#ifdef _PHYSM_HAVE_MMX
  strcat(cpu_flags, "mmx ");
#endif
#ifdef _PHYSM_HAVE_SSE
  strcat(cpu_flags, "sse ");
#endif
#ifdef _PHYSM_HAVE_SSE2
  strcat(cpu_flags, "sse2 ");
#endif
#ifdef _PHYSM_HAVE_SSE3
  strcat(cpu_flags, "sse3 ");
#endif
#ifdef _PHYSM_HAVE_3DNow
  strcat(cpu_flags, "3DNow! ");
#endif

  printf("  Processor Flags: %s\n", cpu_flags);

#ifdef _DEBUG
  printf(" ** Compiled with debug on. **\n");
#endif

  if (argv[1] == NULL){
    fprintf(stderr, "Usage: physm_text <file>\n");
    exit(1);
  }

  char *file = argv[1];

  fprintf(stderr, "Running test simulation: \n");
  physm_world_t world;
  int ok = physm_world_init(&world, file, .01);
  if (ok != 0){
    fprintf(stderr, "Error loading world environment,\n");
    exit(1);
  }
  physm_simulate(&world, 1000, 4);
  
}
